package com.operate.controller;

import com.operate.config.HttpConfig;
import com.operate.service.ScreenDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: ZeckZheng
 * @time: 2023/10/31 5:55
 */
@RestController
@RequestMapping("/screen")
public class ScreenController {

    @Autowired
    private ScreenDataService service;

    @Autowired
    private HttpConfig httpConfig;

    @GetMapping("/update")
    public Object updateToken(String token) {
        httpConfig.handRefreshToken(token);
        Map<String, String> map = new HashMap<>();
        map.put("fs_token", httpConfig.getRefreshToken());
        map.put("auth_token", httpConfig.getAccessToken());
        return map;
    }

    @GetMapping("/get/token")
    public Object getRefreshToken(String token) {
        Map<String, String> map = new HashMap<>();
        map.put("fs_token", httpConfig.getRefreshToken());
        map.put("auth_token", httpConfig.getAccessToken());
        return map;

    }

    @GetMapping("/test")
    public String test() {
        return "=======test=======";
    }

}
